/* type Person = {
  name: string;
  age: number;
}

type Animal = {
  name: string;
  age: number;
}

const person: Person = {
  name: 'John',
  age: 30
}

// const animal: Animal = {
//   name: 'Dog',
//   age: 5
// } 

const animal: Animal = person;
const animal2: Animal = {
  name: 'Dog',
  age: 5
}


function greet(person: Person) {
  console.log(`Hello ${person.name}`);
}

greet(animal); */

class User { 
  constructor(
    public firstName: string, // public 是this.firstName = firstName的简写
    public lastName: string,
    public age: number) {
    
  }
}

class Person { 
  firstName: string;
  lastName: string;
  age: number;
  constructor(firstName: string, lastName: string, age: number) {
    this.firstName = firstName;
    this.lastName = lastName;
    this.age = age;
  }
}

let a = new Person('John', 'Doe', 30);
let b = new User('lily', 'smith', 10);

a = b; // OK